package com.geek.factory.service;

import com.geek.factory.entity.Orders;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author author
 * @since 2025-06-19
 */
public interface OrdersService extends IService<Orders> {
    boolean save(Integer[] tContractIds, Orders orders);

    boolean updateOrderWithContracts(Orders orders, Integer[] contractIds);
    List<Integer> findContractIdsByOrderId(Long orderId);

    Map<String, Long> getOrderStatusDistribution();
    List<Map<String, Object>> getOrderTimeSeries(LocalDateTime start, LocalDateTime end, String groupBy);
    Map<String, BigDecimal> getAmountStatistics();
    List<Map<String, Object>> getAmountTrendByStatus(LocalDateTime start, LocalDateTime end);
    /**
     * 获取需要提醒的未开票订单信息
     * @return Map包含未开票订单数量和最近未开票订单列表
     */
    Map<String, Object> getUninvoicedOrderReminders();

}
